<?php
class defaultModel{
	//属性
	public $connection;
	//方法
	public function __construct($dbhost,$dbuser,$dbpasswd,$dbname){
		$this->connection=@mysql_connect($dbhost,$dbuser,$dbpasswd) or die("数据库链接创建失败:".mysql_error()."<br/>");
		//编码设置
		@mysql_query("set names utf8") or die("设置编码失败:".mysql_error()."<br/>");

		//选择数据库
		@mysql_select_db($dbname) or die("选择数据库失败:".mysql_error()."<br/>");

	}
	public function __destruct(){
		mysql_close($this->connection);
	}
	public function getallinfos($uid){
		
		$selectuserinfosql="select * from maintext where uid='$uid'";
		$result=@mysql_query($selectuserinfosql);
		$row=@mysql_fetch_assoc($result);
		return $row;
	}
	public function getrightinfos($uid){
		
		$selecttitleinfosql="select * from littletitle where uid='$uid'";
		$result=@mysql_query($selecttitleinfosql);
		$row=@mysql_fetch_assoc($result);
		return $row;
	}
}
?>